// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取设备列表 GET /api/device */
export async function queryDevice(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/device', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取设备列表 GET /api/device */
export async function queryDeviceList(
  params?: any,
  options?: { [key: string]: any },
) {
  return request<API.DeviceItem[]>('/api/device/list', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

export async function queryDeviceHistoryList(
  params?: any,
  options?: { [key: string]: any },
) {
  return request<API.DeviceItem[]>('/api/device/history/list', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}



/** 获取设备列表 GET /api/device */
export async function querySimpeDeviceList(
  params?: any,
  options?: { [key: string]: any },
) {
  return request<API.DeviceItem[]>('/api/device/simpelist', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新设备 PUT /api/device */
export async function updateDevice(body: API.DeviceItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 添加设备 POST /api/device */
export async function addDevice(body: API.DeviceItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除设备 DELETE /api/device */
export async function removeDevice(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}

/** 获取设备列表 GET /api/device */
export async function deviceRealtimeList(
  params:any,
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/device/realtime', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}


/** 获取设备列表 GET /api/device */
export async function deviceRealtimeCount(params:any) {
  return request<API.RequestData>('/api/device/realtime/count', {
    method: 'GET' ,
    params: {
      ...params,
    }, });
}

/** 获取设备列表 GET /api/device */
export async function exportDeviceExcel(
  params: {

  },
  options?: { [key: string]: any },
) {
  return request<API.DeviceItem[]>('/api/exportDeviceExcel.do', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}


/** 添加设备 POST /api/device */
export async function batchSaveDevice(body: object, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/batchSave', {
    method: 'POST',
    requestType: 'form',
    data: body,
    ...(options || {}),
  });
}

/** 批量更新设备 POST /api/device */
export async function batchUpdateDevice(body: object, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/batchUpdate', {
    method: 'POST',
    requestType: 'form',
    data: body,
    ...(options || {}),
  });
}

/** 批量更新设备UseState POST /api/device */
export async function batchUpdateState(body: object, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/batchUpdateUseState', {
    method: 'POST',
    requestType: 'form',
    data: body,
    ...(options || {}),
  });
}



/** 设备详情页 GET /api/device/${param0} */
export async function getDeviceInfo(
  params: {
    // path
    /** 设备id */
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.DeviceItem>(`/api/device/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 首页设备统计 */
export async function getDeviceTatol(
  params: {
    areaId?: number;
  },

) {
 
  return request<API.DeviceItem>(`/api/home/statistics`, {
    method: 'GET',
    params: { ...params },

  });
}



export async function getDeviceHistoryData(
  params?:any,
) {
 
  return request<API.DeviceItem>(`/api/device/history/data`, {
    method: 'GET',
    params: { ...params },

  });
}




/** 删除设备DELETE  */
export async function batchDelDevice(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/device/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}